<template>
    <view class="container">
        <view class="mar_t">
            <view @tap="goindex" class="shop_list bor_bottom pa" :data-id="item.id" :data-storeid="item.store_id" v-for="(item, index) in group_list" :key="index">
                <view>
                    <image mode="aspectFill" :src="item.logo"></image>
                </view>

                <view>
                    <view class="fon_30 gobyndsingle shop_name">{{ item.name }}</view>
                    <view class="shop_info">
                        <text class="fon_36" :style="'color:' + color">￥</text>
                        <text class="fon_36" :style="'color:' + color">{{ item.pt_price }}</text>
                        <text class="fon_24 text_c color_6 mar_l">￥{{ item.y_price }}</text>
                        <view class="right_group" :style="'border:2rpx solid ' + color + ';'">
                            <view class="dis_in t_c">
                                <text :style="'color:' + color">{{ item.people }}人团</text>
                            </view>
                            <view class="dis_in" :style="'background:' + color + ';color:#fff'">
                                <image mode="aspectFill" src="./static/collage/buy_shop.png"></image>
                                <text>去开团</text>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            page: 1,
            group_list: [],
            id: '',
            store_id: '',
            store_logo: '',
            display: '',
            color: ''
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        uni.setNavigationBarTitle({
            title: t.title
        });
        console.log(t);
        if (null == t.id) {
            var o = '';
        } else {
            o = t.id;
        }
        if (null == t.store_id) {
            var a = '';
        } else {
            a = t.store_id;
        }
        if (null == t.store_logo) {
            var e = '';
        } else {
            e = t.store_logo;
        }
        if (null == t.display) {
            var i = '';
        } else {
            i = t.display;
        }
        this.setData({
            id: o,
            store_id: a,
            store_logo: e,
            display: i
        });
        uni.showLoading({
            title: '正在加载'
        });
        this.reload();
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {
        this.reload();
    },
    onShareAppMessage: function () {},
    methods: {
        reload: function (t) {
            var that = this;
            var a = that.page;
            var e = that.group_list;
            app.globalData.util.request({
                url: 'entry/wxapp/GroupGoods',
                cachetime: '0',
                data: {
                    store_id: that.store_id,
                    type_id: that.id,
                    page: a,
                    display: that.display
                },
                success: function (t) {
                    console.log('商品列表', t);
                    console.log(e);
                    if (0 < t.data.length) {
                        uni.hideLoading();
                        e = e.concat(t.data);
                        that.setData({
                            group_list: e,
                            page: a + 1
                        });
                    }
                }
            });
        },

        goindex: function (t) {
            uni.navigateTo({
                url: 'index?id=' + t.currentTarget.dataset.id + '&store_id=' + t.currentTarget.dataset.storeid + '&store_logo=' + this.store_logo
            });
        }
    }
};
</script>
<style>
@import './list.css';
</style>
